package site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview.provider

import android.view.View
import com.blankj.utilcode.util.ToastUtils
import com.chad.library.adapter.base.entity.node.BaseNode
import com.chad.library.adapter.base.provider.BaseNodeProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import site.marqstree.kotlin.library.good.R
import site.marqstree.kotlin.library.good.ui.fragment.category.centent.bean.FootBean


/*
 * 项目名: KotlinMall
 * 包名: site.marqstree.kotlin.library.good.ui.fragment.category.centent.recyclerview.provider
 * 文件名: FooterNodeProvider
 * 创建者: marqstree
 * 创建时间: 2020/3/7 20:44
 * 描述: TODO
 */
class FooterNodeProvider: BaseNodeProvider() {

    init{
        // 注册需要点击的子view id
        addChildClickViewIds(R.id.mFooterTv)
    }

    override val itemViewType: Int
        get() = 2
    override val layoutId: Int
        get() = R.layout.category_content_footer

    override fun convert(helper: BaseViewHolder, data: BaseNode) {
        val footBean = data as FootBean
        helper.setText(R.id.mFooterTv,footBean.title)
    }

    override fun onChildClick(helper: BaseViewHolder, view: View, data: BaseNode, position: Int) {
        if(view.id==R.id.mFooterTv){
            ToastUtils.showShort("点击页脚")
        }
    }
}